// pages/classify/index.js
Page({
  data: {
    classifyList: [],
    goodsList: []
  },
  onLoad() {
    this.getclassifyInfo()
  },
  async getclassifyInfo() {
    const { message, meta } = await wx.http.get('/api/public/v1/categories')
    if (meta.status !== 200) wx.utils.toast('获取商品分类信息失败！')
    this.setData({
      classifyList: message,
      goodsList: message[0].children
    })
  },
  sidebarChange({ detail }) {
    this.setData({
      goodsList: this.data.classifyList[detail].children
    })
  }
})